package vmcs.customer.state;

import vmcs.controller.TransactionController;
import vmcs.store.CashStore;
import vmcs.store.Coin;
import vmcs.store.Store;

public class DrinkSelectedState implements State {

	private TransactionController transactionController;
	private static DrinkSelectedState instance;

	private DrinkSelectedState(TransactionController transactionController) {
		this.transactionController = transactionController; 
	}

	public static DrinkSelectedState getInstance(TransactionController transactionController) {
		if (instance == null) 
			instance = new DrinkSelectedState(transactionController);
		return instance;
	} 


	@Override
	public void insertCoin(int value){
		transactionController.setTotalInsertedCoins(transactionController.getTotalInsertedCoins()+value);
		if (value < transactionController.getPrice()){
			transactionController.getCoinReceiver().continueReceive();
			transactionController.setState(transactionController.getCoinInsertedState());
		}
		else{
			transactionController.setState(transactionController.getEnoughCoinsInserted());
			transactionController.dispenseDrink();
		}


	}


	@Override
	public void selectDrink(int selectedIdx) {
		// TODO Auto-generated method stub

	}

	@Override
	public void cancel() {
		// TODO Auto-generated method stub

	}

	@Override
	public void dispenseDrink(int drinkSelected) {
		// TODO Auto-generated method stub

	}

	@Override
	public void giveChange(int changeRequired) {
		// TODO Auto-generated method stub

	}

	@Override
	public void storeCash() {
		// TODO Auto-generated method stub

	}
	
	@Override
	public void terminateMachine() {
	
	} 


}
